#ifndef GAMEENGINE_AI_PATH_FINDING_ASTAR_NODE_H
#define GAMEENGINE_AI_PATH_FINDING_ASTAR_NODE_H

#include <GameEngine/AI/ai_settings.h>


#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

struct AStarNodeCostComparer;


//! A node with useful information for the A-star algorithm
/*!
 *  The A-star node comes with informations about its parent node, which allow to rebuild the
 *  path after the end node has been reached, and informations about the total cost spent so
 *  far to reach the current node.
 *
 @sa The AStar class for path-finding in a graph.
 */
template <class Graph>
class AStarNode {
	friend struct AStarNodeCostComparer;

public:
	AStarNode();
	AStarNode(typename Graph::Node node, typename Graph::Node parent, typename Graph::Cost cost);
	AStarNode(const AStarNode& rhs);
	AStarNode& operator=(const AStarNode& rhs);
	~AStarNode();

	typename Graph::Node node() const;
	typename Graph::Node& node();

	typename Graph::Node parent() const;
	typename Graph::Node& parent();

	typename Graph::Cost cost() const;
	typename Graph::Cost& cost();

	bool operator<(const AStarNode& rhs) const;

private:
	//! Node associated to the A-star search
	typename Graph::Node node_;

	//! Parent of the node associated to the A-star search
	typename Graph::Node parent_;

	//! Total cost spent so far to reach the node
	typename Graph::Cost cost_;
};



#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#include <GameEngine/AI/PathFinding/astar_node.hpp>

#endif
